USE [NANS21V]
GO

/****** オブジェクト: SqlProcedure [dbo].[KyogiInfo] スクリプト日付: 2014/05/27 14:37:50 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[KyogiInfo]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[KyogiInfo]
GO

CREATE PROCEDURE [dbo].[KyogiInfo]
	@TAIKAINO int,
	@KYOGINO int
AS
SELECT 
	K.SYUMOKUNO, 
	S.SYUBETUMEI,
	dbo.Seibetu(K.SEIBETUNO) AS SEIBETU,
	K.KYOGIMEI, 
	K.KYOGIKANA, 
	K.KYOGISEISIKI, 
	(CASE K.KIROKUA WHEN '0' THEN '' END) AS KIROKUA,
	K.KIROKUFLGA, 
	(CASE K.KIROKUB WHEN '0' THEN '' END) AS KIROKUB,
	K.KIROKUFLGB,
	SM.SYUMOKUMEI
FROM 
	TBL_KYOGI AS K,
	TBL_SYUMOKU_MASTER AS SM,
	TBL_SYUBETU AS S
WHERE 
	K.TAIKAINO = @TAIKAINO 
	AND K.KYOGINO = @KYOGINO
	AND K.SYUMOKUNO = SM.SYUMOKUNO
	AND K.SYUBETUNO = S.SYUBETUNO